Repository navigation
agent: fix mail stack on Debian 13 (Dovecot 2.4 pgsql syntax, postfix inaccurate state) - #509
Merged
Merged
Conversation
… status unit)
Two deployment bugs found bringing up the first real mail host:
- dovecot.conf.ejs rendered libpq key/values (dbname/user/password)
directly inside the pgsql block, which Dovecot 2.4 rejects
('Unknown setting: dbname' — pgsql only has pgsql_parameters). Nest
them in parameters { }; mysql keeps its native per-key settings.
doveconf -n refused the config at every apply, so the managed dovecot
config was never installed.
- The check-in reported postfix state from the postfix@- instance.
That matches Debian <= 12 (postfix.service is a RemainAfterExit
wrapper), but Debian 13 runs master directly in postfix.service and
leaves postfix@- inactive, so a healthy MTA showed as 'postfix:
inactive' on the Agents page. Report the instance state when it says
anything meaningful, and fall back to postfix.service only when it
has a running main process (SubState=running), which still excludes
the old wrapper's active (exited).
ManagedService.statusUnit is replaced by an optional status() override
(postfix was its only user); system.ts gains getServiceSubState.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cmyers-mieweb
requested review from
runleveldev
and
a balanced review from Copilot
November 6, 2026 20:38
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The deployment fixes require on-host validation with Dovecot 2.4 and both Postfix systemd layouts because existing tests do not confirm parser acceptance or actual D-Bus service states.
No open issues 🎉
What changed in this PR
Fixes Debian 13 mail deployment and status reporting in the agent while preserving support for older Debian Postfix layouts.
Changes:
- Nests PostgreSQL connection settings under Dovecot 2.4’s
parametersblock while retaining MySQL syntax. - Adds a service-status override so Postfix reporting can distinguish a running daemon from an exited wrapper.
- Adds regression tests for Dovecot SQL configuration and Postfix status selection.
| File | Description |
|---|---|
agent/test/postfix-status.test.js |
Tests Postfix status selection across Debian service layouts. |
agent/test/mail-template.test.js |
Tests PostgreSQL parameter nesting and unchanged MySQL syntax. |
agent/templates/mail/dovecot.conf.ejs |
Corrects PostgreSQL configuration syntax for Dovecot 2.4. |
agent/src/system.ts |
Shares systemd property lookup and adds SubState retrieval. |
agent/src/mail.ts |
Selects Postfix status using instance state and main-service running state. |
agent/src/index.ts |
Uses service-specific status overrides during check-in. |
agent/src/apply.ts |
Replaces statusUnit with an optional status callback. |
Review effort: Balanced
runleveldev
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two deployment bugs found bringing up the first real mail host: #384
dovecot.conf.ejs rendered libpq key/values (dbname/user/password) directly inside the pgsql block, which Dovecot 2.4 rejects ('Unknown setting: dbname' — pgsql only has pgsql_parameters). Nest them in parameters { }; mysql keeps its native per-key settings. doveconf -n refused the config at every apply, so the managed dovecot config was never installed.
The check-in reported postfix state from the postfix@- instance. That matches Debian <= 12 (postfix.service is a RemainAfterExit wrapper), but Debian 13 runs master directly in postfix.service and leaves postfix@- inactive, so a healthy MTA showed as 'postfix: inactive' on the Agents page. Report the instance state when it says anything meaningful, and fall back to postfix.service only when it has a running main process (SubState=running), which still excludes the old wrapper's active (exited).
ManagedService.statusUnit is replaced by an optional status() override (postfix was its only user); system.ts gains getServiceSubState.